<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title></title>
	<script src="../../js/common.js"></script>
	<script src="../../js/vue.js"></script>
	<script src="../../js/jquery-2.1.1.min.js"></script>
</head>

<body>
	<p id="logout" @click="logout" style="text-align: right; margin-right: 50px; color: red; cursor: pointer;">
		注销
	</p>
</body>

<script>
	window.onload = function () {

		const vue = new Vue({
			el: '#logout',
			methods: {

				logout: function () {
					//alert('------');

					let url = getRootPath() + "logout";


					let callback = function (result) {
						//alert(result);
						console.log(result);
						let code = result.code;
						if (code === 200) {
							console.log("-------------注销成功-------------------");

							//清除
							localStorage.removeItem("token");

							//演示的时候可以打开  会发现注销后就不会查询到数据 对后端的接口起到了保护作用
							//return false;

							window.parent.location.href = "../../login.html";

						}
					};

					//https://blog.csdn.net/ljy_1024/article/details/97006783
					sendGet(url, callback);
				}

			}
		});
	}
</script>

</html>